@extends('common.layout')

@section('title', '添加')

@section('body')
    <body>
    <form class="layui-form" action="/admin/admin/{{isset($row) ? 'edit' : 'add'}}">
        <div class="mainBox">
            <div class="main-container">
                <div class="main-container">

                    @isset($row)
                        <input type="hidden" name="form[id]" value="{{$row->id}}">
                    @endisset

                    <div class="layui-form-item">
                        <label class="layui-form-label">昵称</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[nickname]" lay-verify="require" autocomplete="off" placeholder="昵称" class="layui-input" value="{{$row->nickname ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[username]" lay-verify="require" autocomplete="off" placeholder="账号" class="layui-input" value="{{$row->username ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[password]" lay-verify="{{isset($row) ? 'require' : ''}}" autocomplete="off" placeholder="{{isset($row) ? '默认为空不修改密码!' : '请输入初始密码'}}" class="layui-input" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">头像</label>
                        <div class="layui-input-inline">
                            <input type="text" id="c-avatar" name="form[avatar]" lay-verify="require" autocomplete="off" class="layui-input" value="{{$row->avatar ?? admin_theme_url('/admin/images/avatar.jpg')}}">
                            <div class="layui-upload" style="padding-top: 5px">
                                <div class="layui-upload-list">
                                    <img class="layui-upload-img img-preview avatar" src="{{$row->avatar ?? admin_theme_url('/admin/images/avatar.jpg')}}" style="width:70px;height:70px;border: 1px solid rgb(200, 200, 200);border-radius: 50%;overflow:hidden;">
                                </div>
                            </div>
                        </div>
                        <div class="layui-input-inline">
                            <button type="button" class="layui-btn upload">上传</button>
                            <button type="button" class="layui-btn attachment">选择</button>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-block">
                            <input type="text" name="form[email]" class="layui-input" value="{{$row->email ?? ''}}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">登录失败次数</label>
                        <div class="layui-input-block">
                            <input type="number" name="form[loginfailure]" class="layui-input" value="{{$row->loginfailure ?? 0}}">
                        </div>
                    </div>

                    @include('common.component.form.select', ['title' => '状态', 'list' => ['normal' => '正常', 'disibled' => '禁用'], 'name' => 'form[status]', 'value' => $row->status ?? 'normal'])

                    <div class="layui-form-item">
                        <label class="layui-form-label">角色授权</label>
                        <div class="layui-input-block">
                            <div id="form-role" class="eleTree" data-input-id="form-role-input" data-id="{{$row->id ?? 0}}"></div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="button-container">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="save">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>
    @parent
    </body>
@endsection

